package com.baicaoyuan.web.common.exception;

/**
 * @author lfx
 *         返回客户端结果定义
 */
public enum StateMessage {

    SUCCESS(true, "200", "成功"),

    FAILED(false, "305", "失败"),
    LOSE_PARAM(false, "002", "缺少参数"),
    CAPTCHA_FAILURE(false, "005", "验证码不匹配"),
    CAPTCHA_CLICK(false, "006", "点击获取验证码"),

    INVITATION_CODE_ERROR(false, "034", "邀请码无效"),
    INVITATION_CODE_CODE(false, "035", "邀请码已被冻结，请获取正常的邀请码"),
    PHONE_ERROR(false, "001", "手机号不匹配"),
    USER_NOT_EXIST(false, "003", "用户不存在"),
    CAPTCHA_OVERDUE(false, "004", "验证码过期"),

    LOGIN_OTHER_DEVICE(false, "007", "异常登录"),
    TOKEN_ERROR(false, "008", "用户凭证错误"),
    NO_RIGHT(false, "038", "没有登录权限"),
    TOKEN_NO(false, "108", "无用户凭证"),
    OPERATION_FAILED(false, "009", "操作失败"),
    OUT_PERMISSION(false, "010", "权限不足"),
    PARAMETER_FORMAT_ERROR(false, "011", "参数格式不匹配"),
    BASIC_DATE_ERROR(false, "012", "基础数据获取失败"),
    PHONE_EXIST(false, "016", "手机已存在"),
    PHONE_NO_EXIST(false, "017", "手机不存在"),
    PASSWORD_NO_EMPTY(false, "018", "密码不能为空"),
    LOGIN_FAILED(false, "022", "密码错误"),
    SYSTEM_DELETE_FALSE(false, "024", "删除失败"),
    UPDATE_FALSE(false, "027", "更新失败"),
    COMMIT_FAILED(false, "028", "申请失败，有可能被盗号，恶意申请！"),
    UN_KNOW_REASON(false, "999", "请重试"),
    SAVE_FAILED(false, "1000", "保存不成功");

    private boolean state;
    private String errorCode;
    private String message;


    StateMessage(boolean state, String errorCode, String message) {
        this.state = state;
        this.errorCode = errorCode;
        this.message = message;
    }

    public boolean getState() {
        return state;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public String getMessage() {
        return message;
    }

    public StateMessage appendMessage(String append) {
        this.message += append;
        return this;
    }
}
